package com.wt.admin.controller.sys;


import com.aizuda.easy.security.domain.Rep;
import com.aizuda.easy.security.domain.Req;
import com.wt.admin.config.aspect.annotation.LogAno;
import com.wt.admin.domain.entity.sys.SysMenuEntity;
import com.wt.admin.domain.vo.sys.UserVO;
import com.wt.admin.service.sys.SysMenuService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("menu")
public class SysMenuController {

    @Resource
    private SysMenuService sysMenuService;

    @LogAno(name = "菜单列表")
    @PostMapping("find")
    public Rep<List<SysMenuEntity>> find(@RequestBody Req<SysMenuEntity, UserVO> req){
        return Rep.ok(sysMenuService.find(req.getData()));
    }

    @LogAno(name = "修改或添加菜单")
    @PostMapping("edit")
    public Rep<SysMenuEntity> edit(@RequestBody Req<SysMenuEntity,UserVO> req){
        return Rep.ok(sysMenuService.edit(req.getData()));
    }

    @LogAno(name = "删除菜单")
    @PostMapping("del")
    public Rep<SysMenuEntity> del(@RequestBody Req<SysMenuEntity,UserVO> req){
        return Rep.ok(sysMenuService.del(req.getData()));
    }

}
